﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/HomeSite.Master" Inherits="System.Web.Mvc.ViewPage<TimeTableManagement.Entities.Tb_Slot_Room>" %>

<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>

<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%-- code ho tro chay ajaxtoolkit --%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<%-- code ho tro chay ajaxtoolkit --%>
<ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true" ID="ScriptManager1" ScriptMode="Debug" CombineScripts="false" />

    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="100%" 
        CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" 
        GroupBoxCaptionOffsetY="-28px" 
        SpriteCssFilePath="~/App_Themes/Aqua/{0}/sprite.css">
        <ContentPaddings Padding="14px" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
<script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>
<%-- Trung them JavaScript o day --%>
<% 
    //Getting the current context of HTTP request
    var context = HttpContext.Current;
    //Formatting the fully qualified website url/name
    var appPath = string.Format("{0}://{1}{2}{3}",
                                context.Request.Url.Scheme,
                                context.Request.Url.Host,
                                context.Request.Url.Port == 80
                                    ? string.Empty
                                    : ":" + context.Request.Url.Port,
                                context.Request.ApplicationPath);

    if (!appPath.EndsWith("/"))
        appPath += "/";
%>
<script type="text/javascript">
    function showroom() {
        $id = document.getElementById('id_room').value;
        if ($id == "") {
            return;
        } 
        $path = "<%: appPath  %>Room/Details2/" + $id;
        $.ajax({
            url: $path,
            context: "",
            success: function (data) {
                document.getElementById('roomdescription').textContent = data;
            }
        });
    }
    function showslot() {
        $id = document.getElementById('id_slot').value;
        if ($id == "") {
            return;
        }
        $path = "<%: appPath  %>Slot/Details2/" + $id;
        $.ajax({
            url: $path,
            context: "",
            success: function (data) {
                document.getElementById('slotdescription').textContent = data;
            }
        });
    }
</script>
<script type="text/javascript">
    $(document).ready(function () {
        document.getElementById('id_room').setAttribute("onchange", "showroom()");
        document.getElementById('id_slot').setAttribute("onchange", "showslot()");
    });
</script>

<% using (Html.BeginForm()) { %>
    <%: Html.ValidationSummary(true) %>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.id_room, "Tb_Room") %>
        </div>
        <div class="editor-field">
            <%: Html.DropDownList("id_room", String.Empty) %>
            <%: Html.ValidationMessageFor(model => model.id_room) %>
            <asp:Label ID="roomdescription"></asp:Label>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.id_slot, "Tb_Slot") %>
        </div>
        <div class="editor-field">
            <%: Html.DropDownList("id_slot", String.Empty) %>
            <%: Html.ValidationMessageFor(model => model.id_slot) %>
            <asp:Label ID="slotdescription"></asp:Label>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.action) %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.action) %>
            <%: Html.ValidationMessageFor(model => model.action) %>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.date) %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.date) %>
            <%: Html.ValidationMessageFor(model => model.date) %>
            <script>
                $("#date").addClass('tcal');
            </script>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.description) %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.description) %>
            <%: Html.ValidationMessageFor(model => model.description) %>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.status) %>
        </div>
        <div class="editor-field">
            <%: Html.EditorFor(model => model.status) %>
            <%: Html.ValidationMessageFor(model => model.status) %>
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>

<% } %>

<div>
    <%: Html.ActionLink("Back to List", "Index") %>
</div>
</dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
<script src="../../Scripts/tcal.js" type="text/javascript"></script>
<link rel="Stylesheet" type="text/css" href="../../Content/tcal.css" />

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="leftmenu" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="menuright" runat="server">
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="Footer" runat="server">
</asp:Content>
